<%@ Page Title="Member_Withdraw List" Language="C#" AutoEventWireup="true" CodeBehind="Member_WithdrawList.aspx.cs" Inherits="Youz.CreditRepay.Manage.Member_WithdrawList" %>

<script>
    //loadCSS("assets/plugins/gritter/css/jquery.gritter.css");

    var requireJS = [
        //"assets/plugins/gritter/js/jquery.gritter.min.js"
    ];

    loadJS(requireJS);
    $(function () {
        $('.form_date').datetimepicker({
            language: "zh_CN",
            format: "yyyy-mm-dd",
            autoclose: true,
            todayBtn: true,
            todayHighlight: true,
            pickerPosition: "bottom-left",
            startView: 2,
            minView: 2,
            forceParse: 0
        });
    });
</script>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading" data-original-title>
                <h2><i class="fa fa-align-justify"></i><span style="font-size: 16px; padding-right: 15px;"><%: R(LanguageModule.Member_Withdraw, "Member_Withdraw", "Member_Withdraw") %></span></h2>
                <div class="panel-actions"></div>
            </div>
            <div class="panel-body">
                <div class="alert alert-danger" style="display: none;">
                    <button type="button" class="close" data-dismiss="alert">×</button><strong><i class="fa fa-warning"></i></strong><span class="content"></span>
                </div>
                <form class="form-horizontal">
                    <div class="row">
                        <div class="col-md-3">
                            <div class="form-group">
                                <label class="col-md-3 control-label"><%: R(LanguageModule.M_Common, "MemberAccount", "会员帐号") %></label>
                                <div class="col-md-9">
                                    <input type="email" id="MemberAccount" maxlength="45" name="MemberAccount" class="form-control" placeholder="<%: R(LanguageModule.M_Common, "MemberAccount", "会员帐号") %>">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="RoleDesc"><%: R(LanguageModule.M_Common, "Status", "状态") %></label>
                                <div class="col-md-9">
                                    <select name="Status" id="Status" class="form-control">
                                        <option value=""><%: R(LanguageModule.M_Common, "All", "全部") %></option>
                                        <option value="1"><%: R(LanguageModule.Member_Withdraw, "Pending", "待审核") %></option>
                                        <option value="2"><%: R(LanguageModule.Member_Withdraw, "Review", "审核中") %></option>
                                        <option value="3"><%: R(LanguageModule.Member_Withdraw, "Fail", "审核未通过") %></option>
                                        <option value="4"><%: R(LanguageModule.Member_Withdraw, "Completed", "已完成") %></option>
                                        <option value="5"><%: R(LanguageModule.Member_Withdraw, "Revoked", "已撤消") %></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-3 control-label"><%: R(LanguageModule.Member_Withdraw, "createTime", "创建时间") %></label>
                                <div class="col-md-9">
                                    <div class="input-group">
                                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                        <input type="text" data-date-format="yyyy/mm/dd" id="StartDate" class="form-control form_date" />
                                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                        <input type="text" data-date-format="yyyy/mm/dd" id="EndDate" class="form-control form_date" />
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-2">
                            <button type="button" id="btnQuery" name="btnQuery" class="btn btn-default btn-ar btn-primary">
                                <i class="fa fa-search "></i>
                                <%: R(LanguageModule.M_Common, "Query") %>
                            </button>
                        </div>
                    </div>
                    <%--<div class="row">
                        <div class="col-md-2">
                            <button type="button" id="btnPayment" name="btnPayment" class="btn btn-default btn-ar btn-primary">
                                提交易支付代付
                            </button>
                        </div>
                    </div>--%>
                </form>
                <table id="table" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%"></table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var dt;

    $(function () {
        $("#btnPayment").click(function () {
            $.post("/PayEase/Handlers/PayEaseHandler.ashx?type=AddPayment", function (data) {
                console.log(data);
            }, "json");
        });

        dt = $('#table').DataTable({
            "ajax": {
                "url": 'Member/Handlers/Member_WithdrawHandler.ashx?type=list',
                "type": "POST",
                "dataSrc": "data",
                "data": function (d) {
                    d.MemberAccount = $('#MemberAccount').val();
                    d.Status = $('#Status').val();
                    d.StartDate = $('#StartDate').val();
                    d.EndDate = $('#EndDate').val();
                }
            },
            "columns": [
                    { "data": 'RowIndex', "title": "#" },
                    {
                        data: "WithdrawID",
                        title: '操作',
                        width: 60,
                        render: function (data, type, row) {
                            if (row.Status == 1 || row.Status == 2) {
                                return "<a href='javascript:;' class='btn btn-info btn-xs' title='审核' onclick='Audit(\"" + row.WithdrawID + "\",\"" + row.Status + "\",\"" + row.MemberAccountStatus + "\")'><i class='fa fa-pencil'> 审核</i></a>";
                            } else {
                                return "<a href='javascript:;' class='btn btn-default btn-xs active' title='查看' onclick='Audit(\"" + row.WithdrawID + "\",\"" + row.Status + "\",\"" + row.MemberAccountStatus + "\")'><i class='fa fa-eye'> 查看</i></a>";
                            }
                        },
                        className: "dt-body-center"
                    },
                    { "data": 'WithdrawID', "title": "<%: R(LanguageModule.Member_Withdraw, "WithdrawID", "提现ID") %>", visible: false },
                    { "data": 'MemberAccount', "title": "<%: R(LanguageModule.M_Common, "MemberAccount", "会员帐号") %>" },
                    { "data": 'MemberAccountStatus', "title": "<%: R(LanguageModule.M_Common, "MemberAccountStatus", "会员状态") %>", render: mStatus },
                    { "data": 'Status', "title": "<%: R(LanguageModule.Member_Withdraw, "Status", "状态") %>", render: WStatus },
                    <%--{ "data": 'MoneyType', "title": "<%: R(LanguageModule.Member_Withdraw, "MoneyType", "币种") %>" },--%>
                    { "data": 'WithdrawAmount', "title": "<%: R(LanguageModule.Member_Withdraw, "WithdrawAmount", "提现金额") %>", render: fmoney },
                    { "data": 'WithdrawFee', "title": "<%: R(LanguageModule.Member_Withdraw, "WithdrawFee", "手续费") %>", render: fmoney },
                    { "data": 'BankName', "title": "<%: R(LanguageModule.Member_Withdraw, "BankName", "银行名称") %>" },
                    { "data": 'BankAccountNo', "title": "<%: R(LanguageModule.Member_Withdraw, "BankAccountNo", "银行账户号") %>" },
                    { "data": 'BankAccountName', "title": "<%: R(LanguageModule.Member_Withdraw, "BankAccountName", "银行賬戶名") %>" },
                    { "data": 'BankProvince', "title": "<%: R(LanguageModule.Member_Withdraw, "BankProvince", "银行所在地") %>" },
                    <%--{ "data": 'BankPosition', "title": "<%: R(LanguageModule.Member_Withdraw, "BankPosition", "银行位置") %>" },
                    { "data": 'BankCountry', "title": "<%: R(LanguageModule.Member_Withdraw, "BankCountry", "银行所在国家") %>" },--%>
                  <%--  { "data": 'Address', "title": "<%: R(LanguageModule.Member_Withdraw, "Address", "收款人地址") %>" },--%>
                    { "data": 'CreateTime', "title": "<%: R(LanguageModule.Member_Withdraw, "CreateTime", "创建时间") %>" },
                    { "data": 'StatusRecordMemo', "title": "<%: R(LanguageModule.Member_Withdraw, "AuditOpinion", "审核意见") %>" },
                    { "data": 'ModifyTime', "title": "<%: R(LanguageModule.Member_Withdraw, "AuditTime", "审核时间") %>" },
            ]
        });
        $('#btnQuery').click(function () {
            if (validateStartDateEndDate($('#StartDate').val(), $('#EndDate').val())) {
                dt.ajax.reload();
            }
        });
    });
    function WStatus(value) {
        switch (value) {
            case 1:
                return '<span class="label label-info"><%: R(LanguageModule.Member_Withdraw, "Pending", "待审核") %></span>';
                break;
            case 2:
                return '<span class="label label-primary"><%: R(LanguageModule.Member_Withdraw, "Review", "审核中") %></span>';
                break;
            case 3:
                return '<span class="label label-danger"><%: R(LanguageModule.Member_Withdraw, "Fail", "审核未通过") %></span>';
                break;
            case 4:
                return '<span class="label label-success"><%: R(LanguageModule.Member_Withdraw, "Completed", "已完成") %></span>';
                break;
            case 5:
                return '<span class="label label-default"><%: R(LanguageModule.Member_Withdraw, "Revoked", "已撤消") %></span>';
                break;
            case 6:
                return '<span class="label label-primary"><%: R(LanguageModule.Member_Withdraw, "Submit", "代付中") %></span>';
                break;

        }
    }
    //0未激活，1正常，2不能登录，3不能操作资金
    function mStatus(value, row) {
        switch (value) {
            case 0:
                return "<span class='label label-default'><%=R(LanguageModule.M_Common, "NotActivated", "未激活") %> </span>";
                break;
            case 1:
                return "<span class='label label-primary'><%=R(LanguageModule.M_Common, "normal", "正常") %></span>";
                break;
            case 2:
                return "<span class='label label-success'><%=R(LanguageModule.M_Common, "nolog", "不能登录") %></span>";
                break;
            case 3:
                return "<span class='label label-danger'><%=R(LanguageModule.M_Common, "Inoperablefunds", "不能操作资金") %></span>";
                break;
        }
    }
    function Audit(WithdrawID, Status, MemberAccountStatus) {

        if (MemberAccountStatus != 1 && Status == 1) {
            jalert("该会员状态存在问题无法进行审核!");
            return false;
        }
        if (WithdrawID.length > 0) {
            loadPage("Member/Member_WithdrawItem.aspx?WithdrawID=" + WithdrawID + "&Status=" + Status);
        }
    }
</script>
